package com.example.xiongan_app_yy.plugin;

import android.app.Activity;
import android.util.Log;

import androidx.lifecycle.Observer;

import java.util.concurrent.TimeUnit;

import io.flutter.plugin.common.EventChannel;
import io.flutter.plugin.common.PluginRegistry;

/**
 * @ProjectName: android
 * @Package: com.example.xiongan_app_yy.plugin
 * @ClassName: FlutterPluginCounter
 * @Description: 描述：本地地图页面向flutter发送消息插件注册
 * @Author: 吴航
 * @CreateDate: 2019/10/23 16:41
 * @UpdateUser: 更新者：
 * @UpdateDate: 2019/10/23 16:41
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class FlutterPluginCounter implements EventChannel.StreamHandler {

    public static String CHANNEL0 = "com.example.xiongan_app_yy/native";

    static EventChannel channel;
    public static EventChannel.EventSink send;

    private Activity activity;
    static String msg;

    private FlutterPluginCounter(Activity activity) {
        this.activity = activity;
    }

    public static void registerWith(PluginRegistry.Registrar registrar) {
        channel = new EventChannel(registrar.messenger(), CHANNEL0);
        FlutterPluginCounter instance = new FlutterPluginCounter(registrar.activity());
        channel.setStreamHandler(instance);
    }



    @Override
    public void onListen(Object o, final EventChannel.EventSink eventSink) {
        send=eventSink;
    }

    @Override
    public void onCancel(Object o) {
        Log.i("FlutterPluginCounter", "FlutterPluginCounter:onCancel");
    }

}
